<include file="Public:header" />
<div class="headbar">
    <div class="position"><span>商品</span><span>></span><span>品牌管理</span><span>></span><span>品牌列表</span></div>
    <div class="operating">
        <a href="{:U('Goods/brand_edit')}"><button class="operating_btn" type="button" ><span class="addition">添加品牌</span></button></a>
    </div>
</div>

<div class="content">
    <table id="list_table" class="list_table">
        <colgroup>
            <col width="100px" />
            <col width="150px" />
            <col width="200px" />
            <col width="200px" />
            <col width="150px" />
        </colgroup>

        <thead>
            <tr>
                <th>排序</th>
                <th>品牌名称</th>
                <th>网址</th>
                <th>品牌分类</th>
                <th>操作</th>
            </tr>
        </thead>

        <tbody>
            <foreach name='brand' item='item' key='key'>
            <tr>
                <td><input class="tiny" id="sort{$item['id']}" type="text" onblur="toSort({$item['id']});" value="{$item['sort']}" pattern='int' /></td>
                <td>{$item['name']}</td>
                <td>{$item['url']}</td>
                <td>{$item['category']}</td>
                <td><a href="{:U('Goods/brand_edit', array('bid' => $item[id]))}"><img class="operator" src="__PUBLIC__/Partner/images/admin/icon_edit.gif" alt="修改" /></a><a href="javascript:void(0)" onclick="delModel({link:'{:U('Goods/brand_del', array('bid' => $item[id]))}'})"><img class="operator" src="__PUBLIC__/Partner/images/admin/icon_del.gif" alt="删除" /></a></td>
            </tr>
            </foreach>
        </tbody>
    </table>
</div>

<script language="javascript">
    //排序
    function toSort(id)
    {
        if(id!='')
        {
            var va = $('#sort'+id).val();
            var part = /^\d+$/i;
            if(va!='' && va!=undefined && part.test(va))
            {
                $.get("{:U('Goods/brand_sort')}",{'id':id,'sort':va}, function(data)
                {
                    if(data=='1')
                    {
                        alert('修改商品品牌排序成功!');
                    }else
                    {
                        alert('修改商品品牌排序错误!');
                    }
                });
            }
        }
    }
</script>
<include file="Public:footer" />